<?php
include('top.php');
require_once('pasmy/dbwaarden.php');
$mysql_id = mysql_connect($dbhost, $dbuser, $dbpass);
mysql_select_db($db, $mysql_id);
if (isset($_POST["wijzigen"]))
{
	$telefoon = $_POST["telefoon"];
	$driver = $_POST["driver"];
	$id = $_POST["id"];
	$sql = "UPDATE `teldrivers` SET `nr` = '$telefoon', `driver`='$driver' WHERE `id` = '$id'";
	//echo "SQL: $sql<br>";
	$res = mysql_query($sql, $mysql_id);
	?>
	<br><br>
	<h2><div style="text-align: center">Les don&eacute;es sont modifi&eacute;es</div></h2>
	<?php
	exit();
}
if(isset($_GET["id"]))
{
	
	//echo "<h3>Niveau is nu $_SESSION[login]</h3>";
	if($_SESSION["login"] < 15)
	{	
		$id = $_GET["id"];
		$sql="Select * FROM teldrivers where id = $id";
		//echo "SQL: $sql<br>";
		$res = mysql_query($sql, $mysql_id);
		while ($row = mysql_fetch_row($res))
		{
			$driver = $row[0];
			$telefoon = $row[1];
		}
		?>
		<form action="teldriverswijzigen.php" method="post">
		<br /><br /><br />
		<table border="1" align="center">
		<tr><td colspan="2" class="delsaux">Modifications Telephone</td></tr>
		<tr>
		<td><b>Chauffeur</b></td>
		<td><input type="text" name="driver" size="70" maxlength="40" value="<?php echo $driver;?>"></td>
		</tr>
		<tr>
		<td><b>N&deg; Telephone</b></td>
		<td><input type="text" name="telefoon" size="70" maxlength="150" value="<?php echo $telefoon; ?>"></td>
		</tr>
		<input type="hidden" name="id" value="<?php echo $id; ?>">
		<tr><td colspan="2"><div style="text-align: center"><input type="submit" name="wijzigen" value="Modifier"></div></td></tr>
		</form>
		<?php
	} 
	else 
	{
		session_destroy();
		?>
		Vous n'avez pas les droits n&eacute;cessaire pour modifier les donn&eacute;es !
		<?php
	}
}
?>